package mvp.com.bbc.famvp.mvp.ui;

import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;

import com.kekstudio.dachshundtablayout.DachshundTabLayout;
import com.youth.banner.Banner;

import butterknife.BindView;
import butterknife.ButterKnife;
import mvp.com.bbc.famvp.R;
import mvp.com.bbc.famvp.base.BaseActivity;
import mvp.com.bbc.famvp.base.CommonViewPagerAdapter;
import mvp.com.bbc.famvp.config.GlobalConfig;
import mvp.com.bbc.famvp.mvp.ui.fragment.AndroidFragment;
import mvp.com.bbc.famvp.mvp.ui.fragment.AppFragment;
import mvp.com.bbc.famvp.mvp.ui.fragment.IosFragment;

/**
 * Created by ${cbf} on 2017/11/3.
 */

public class HomeActivity extends BaseActivity {
    @BindView(R.id.main_head_img)
    ImageView mainHeadImg;
    @BindView(R.id.main_banner)
    Banner mainBanner;
    @BindView(R.id.main_tab)
    DachshundTabLayout mainTab;
    @BindView(R.id.main_toolbar)
    Toolbar mainToolbar;
    @BindView(R.id.main_appbar)
    AppBarLayout mainAppbar;
    @BindView(R.id.main_vp)
    ViewPager mainVp;
    @BindView(R.id.main_fab)
    FloatingActionButton mainFab;
    @BindView(R.id.nav_view)
    NavigationView navView;
    @BindView(R.id.mainActivity)
    DrawerLayout mainActivity;

    String[] titles = {
            GlobalConfig.CATEGORY_NAME_APP,
            GlobalConfig.CATEGORY_NAME_ANDROID,
            GlobalConfig.CATEGORY_NAME_IOS,
            GlobalConfig.CATEGORY_NAME_FRONT_END,
            GlobalConfig.CATEGORY_NAME_RECOMMEND,
            GlobalConfig.CATEGORY_NAME_RESOURCE};

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.home_activity;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        CommonViewPagerAdapter viewPagerAdapter = new CommonViewPagerAdapter(getSupportFragmentManager(), titles);
        viewPagerAdapter.addFragment(new AppFragment());
        viewPagerAdapter.addFragment(new AndroidFragment());
        viewPagerAdapter.addFragment(new IosFragment());
        viewPagerAdapter.addFragment(new AppFragment());
        viewPagerAdapter.addFragment(new AndroidFragment());
        viewPagerAdapter.addFragment(new IosFragment());
        mainVp.setAdapter(viewPagerAdapter);
        mainTab.setupWithViewPager(mainVp);

    }

}
